package com.lixin.smartclassroom.ui.home.tab5.activity

import com.drake.brv.utils.bindingAdapter
import com.drake.net.utils.scopeNetLife
import com.lixin.smartclassroom.api.classstudentdatijilu
import com.lixin.smartclassroom.bean.DataListBean
import com.lixin.smartclassroom.databinding.FragmentRecyclerCustomBinding
import com.lixin.smartclassroom.ui.home.adapter.courseReviewClassStudent
import com.lixinkeji.base.BaseActivity
import com.lixinkeji.extension.getIntentString
import com.lixinkeji.extension.gone
import com.lixinkeji.extension.visible

/**
 * Description 班级学生
 * Author: lwc
 * Date:2023/12/9 15:42
 */
class ClassStudentPaperAct : BaseActivity<FragmentRecyclerCustomBinding>() {
    private var classid = ""
    private var studentid = ""
    private var type = 1
    private var listBean = ArrayList<DataListBean>()

    override fun title()="班级学生"

    private fun getData() {
        classid = getIntentString("classid")
        studentid = getIntentString("studentid")

        binding.recycler.courseReviewClassStudent()

        scopeNetLife {
            binding.apply {
                refresh.onRefresh {
                    scopeNetLife {
                        listBean = classstudentdatijilu(index, 10, classid, studentid)!!

                        addData(listBean) {
                            if (binding.recycler.bindingAdapter.models?.size == 0) {
                                binding.state.showEmpty()
                                binding.recycler.gone()
                            } else {
                                binding.recycler.visible()
                            }
                            listBean.size == 10
                        }
                    }
                }.autoRefresh()


            }
        }
    }

    override fun iniView() {
        getData()
    }

    override fun getViewBinding() = FragmentRecyclerCustomBinding.inflate(layoutInflater)

    override fun onClick() {

    }

}